1. Field of the Invention
The invention relates to image processing method and apparatus for automatically discriminating the direction of a document of an image read by a photoelectric converting device such as a CCD or the like.
2. Related Background Art
Hitherto, in an information processing apparatus, characters are generally recognized from original information (image data) read by an optical reader such as a scanner or the like. However, the character recognition is performed on the assumption that the characters were inputted so as to face the proper direction (namely, the characters are arranged in the proper direction for the scanner), so that the character recognition result exactly differs from the input original.
For example, in case of characters 1001 shown in FIGS. 10A to 10D, when an image is inputted so that the character faces the proper direction as shown in FIG. 10A, a recognition result as a character 1011 is correctly obtained. However, in the case where an image is rotated by 270.degree. and is inputted as shown in FIG. 10B, it is erroneously recognized as a character 1012. In the case where image data is rotated by 180.degree. and the image is inputted as shown in FIG. 10C, it is erroneously recognized as a character 1013. In the case where image data is rotated by 90.degree. and the image is inputted as shown in FIG. 10D, it cannot be recognized. Those recognition results are shown for convenience of explanation and the actual results do not always become the results as mentioned above.
In order to avoid the above-mentioned problem that when the input image is character recognized, if the direction of a document is not the proper direction, the correct result cannot be obtained, there is also the following method. Namely, the image inputted by the scanner is displayed and the user judges whether or not the image has been inputted in the proper direction. When the inputting direction is not the proper direction, rotation of the image in an image memory is instructed so as to manually rotate the direction of the image by 90.degree., 180.degree., and 270.degree. by the user, thereby rotating the image, or the setting direction of the original to the scanner is changed to the proper direction and the image is again inputted or the like, thereby correcting the image to the proper direction, and after that, the start of the character recognition is instructed.
However, owing to improvements in the processing speed scanners, an automatic document feeding function called an auto feeder is annexed to the apparatus allowing plurality of originals can be automatically read and inputted. The number of originals as targets to be processed can be set to a large quantity of papers. In such a situation, it is very difficult to perform operations for manually judging the proper direction one by one for a plurality of originals and for correcting the direction of the original image.
The contents of the document of the original is expressed by various patterns such as vertical writing, lateral writing, and the like. That is, for example, there are various kinds of patterns, such as a document of the A4 size that is vertically placed and is written in the lateral direction (see FIG. 11A: for example, this pattern is often used in a lateral writing Japanese document, English document, or the like), a document of the A4 size which is laterally placed and is written in the lateral direction (see FIG. 11B: for example, such a pattern is frequently used in a document having a long sentence, a document for the OHP, a document in case of reducing and copying a document of the A3 size, B4 size, or the like which is laterally placed, or the like), a document of the A4 size which is laterally placed and is laterally written and in which the column setting is switched at the center (see FIG. 11C: for example, such a pattern is often used in case of continuously reducing and copying two sheets of documents of the A4 size), a document of the A4 size which is vertically placed and is vertically written (see FIG. 11D), and the like.
On the other hand, the direction of an image which is displayed on a display screen is determined by the scanning direction (image reading direction) of the scanner when inputting the image. Therefore, in case of reading the original at a position such that the scanning direction of the scanner coincides with the direction of a character train of the document, the document is displayed at the inherent position.
However, in case of the scanner of the A4 size, since the direction of the original is unconditionally determined, the original cannot be read at the position such that the scanning direction of the scanner is made coincide with the direction of the character train of the document and, for example, as shown in FIG. 12B, the document is displayed in a state in which it is rotated by 90.degree. from the inherent position, so that there is a case where it is very difficult to read the image.
Hitherto, there is a method of automatically discriminating the direction of the inputted original so as to reduce the operation to correct the direction of the original by the operator as mentioned above. Namely, as shown in FIG. 13A, there is a method whereby lines of a table, a separator (a), and the like are extracted from an inputted original image and it is judged that the direction of the lines is the lateral direction. As shown in FIG. 13B, there is a method whereby projections (histograms) in the vertical and lateral directions of a document are detected and the direction is judged by checking a degree of delimiter, or the like. According to the above methods, the direction is fairly arbitrarily decided. According to such methods, it is impossible to cope with documents of many kinds of formats as shown in FIGS. 11A to 11D. For example, a condition such that the separator in the lateral direction exists in the document, the document is laterally written, or the like is needed. For a document that does not satisfy such conditions, the direction of the original cannot be automatically discriminated.